<?php
/**
 * Common initialization
 *
 * Project: LanguageTranslation<br/>
 * File: common.php
 *
 * This file should be included to all other files
 *
 * @author Quality Solutions
 * @package inclusions
 */

// Include developer's configuration file if exists
$sConfigDir = dirname(__FILE__);
if (file_exists($sConfigDir.'/config_dev.php')) {
    require_once $sConfigDir.'/config_dev.php';
//    error_reporting(E_ALL ^ E_NOTICE);
    error_reporting(E_ALL);
}

// Include common configuration file
require_once $sConfigDir.'/config.php';

error_reporting(ERROR_REPORTING);

session_start();

// Common inclusions
require_once PATH_INCLUDE.'/dev_utils.php';
require_once PATH_INCLUDE.'/template.php';
require_once PATH_CLASSES.'/Http.php';

// Switch off magic_quotes_gpc
if (get_magic_quotes_gpc()) {
	stripS($_REQUEST);
	stripS($_GET);
	stripS($_POST);
}

function stripS(&$arr) {
	if (empty($arr)) return;
	$names = array_keys($arr);
	foreach ($names as $name) {
		if (is_array($arr[$name])) stripS($arr[$name]);
		else $arr[$name] = stripslashes($arr[$name]);
	}
	return;
} 
?>
